'use strict';
new Component({
  options: {
    addGlobalClass: true,
  },
  externalClasses: ['lee-class'],
  relations: {
    '../grid/main': {
      type: 'parent',
      linked(target) { this._updateWidth(target) },
      linkChanged(target) { this._updateWidth(target) },
      unlinked(target) { this._updateWidth(target) },
    },
  },
  data: {
    width: '0%',
  },
  methods: {
    _updateWidth(node) {
      const width = `${100 / node.data.col}%`;
      this.setData({ width });
    },
  },
});
